package com.cloud.bc.controller.pc;

import cn.hutool.core.bean.BeanUtil;
import com.cloud.bc.controller.BaseController;
import com.cloud.bc.model.domain.UserInfo;
import com.cloud.bc.model.entity.BcSetmealOrders;
import com.cloud.bc.model.entity.BcSetmeals;
import com.cloud.bc.service.BcSetmealOrdersService;
import com.cloud.bc.service.BcSetmealsService;
import com.cloud.bc.service.BcUsersService;
import com.cloud.bc.util.OrderNoUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

//PC VIP套餐
@Controller
@AllArgsConstructor
@RequestMapping("center/setmeal")
public class PcCenterSetmealController extends BaseController {
    private final BcSetmealsService bcSetmealsService;
    private final OrderNoUtil orderNoUtil;
    private final BcSetmealOrdersService bcSetmealOrdersService;
    private final BcUsersService bcUsersService;

    /**
     * VIP套餐
     */
    @GetMapping("")
    public ModelAndView index(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = baseView(request, "VIP套餐-用户中心", "pc/center/setmeal/index");
        view.addObject("bodyCss", " page_manage page_manage_setmeal");
        BcSetmeals bcSetmeals = new BcSetmeals();
        //只显示可购买，且显示的套餐
        bcSetmeals.setDisplay(1);
        bcSetmeals.setApply(1);
        List<BcSetmeals> bcSetmealsList = bcSetmealsService.selectAll(bcSetmeals);
        view.addObject("bcSetmealsList", bcSetmealsList);
        return view;
    }

    /**
     * 套餐使用记录
     */
    @GetMapping("records")
    public ModelAndView records(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = baseView(request, "套餐使用记录-用户中心", "pc/center/setmeal/records");
        view.addObject("bodyCss", "  page_manage page_manage_setmeal");
        return view;
    }

}
